package flextv.core.logic {

import mx.rpc.IResponder;

/**
 * Create a on-the-fly IResponder instance.
 * 
 * Example:
 * new SomeServiceWithIResponderArgument(new ResponderAdapter(
 *				function(result: Object): void {
 *					// ... result handling ...
 *				},
 *				function(faultInfo: Object): void {
 *					// ... error handling ...
 *				}
 *			)).requestService();
 */
public dynamic class ResponderAdapter extends DynamicImplementation implements IResponder {
	
	public function ResponderAdapter(fnResult: Function, fnFault: Function) {
		addFunction("fnResult", fnResult);
		addFunction("fnFault", fnFault);
	}
	
	public function result(data: Object): void {
		this.fnResult(data);
	}
	
	public function fault(info: Object): void {
		this.fnFault(info);
	}
	
}
}